#ifndef CPP_LOOPER_H
#define CPP_LOOPER_H

#include <thread>
#include <string>
#include <vector>

#include <os/MessageQueue.h>

//@brief 消息处理循环
//@author cvte
class Looper {
   public:
    Looper(/* args */);
    ~Looper();
    //是否在当前线程
    bool isCurrentThread();
    //准备主线程消息循环，由系统调用
    static void prepareMainLooper();
    //获得主线程消息循环
    static Looper* getMainLooper();
    //获得线程消息循环
    static Looper* myLooper();
    //准备线程消息循环
    static void prepare();
    //线程消息循环
    static void loop();
    //线程消息退出
    static void quit();
   private:
    static Looper* sMainLooper;
    static Looper* sLooper;
    std::thread::id mThreadId;
    //每个线程维护一份消息队列数据
    MessageQueue mQueue;
    /* data */
};

#endif